package servlets;

import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SearchServlet extends HttpServlet {

	private static final long serialVersionUID = 6193729429741162623L;

	public String name;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doProccessing(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doProccessing(req, resp);
	}

	private void doProccessing(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{

		String pageNum = req.getParameter("page");
		String searchOption = req.getParameter("searchOption");
		req.getSession().setAttribute("searchOption", searchOption);
		String searchTerm ="";
			searchTerm = req.getParameter("searchTerm");
			//createSecondPage(req, resp);
			req.getSession().setAttribute("searchTerm", searchTerm);
			RequestDispatcher dispatcher = req.getRequestDispatcher("Search_Results.jsp");
			dispatcher.forward(req, resp);

	}
}
